<template>
	<div class="sidebar">
		<el-menu
            class="sidebar-el-menu"
            :default-active="onRoutes"
            :collapse="collapse"
            background-color="#2F4050"
            text-color="#bfcbd9"
            active-text-color="#fff"
            unique-opened
            router
            @select="handleSelect"
        >
            <template v-for="item in menuList">
                <template v-if="item.children">
                    <el-submenu :index="item.index" :key="item.key">
                        <template slot="title">
                            <i :class="item.icon"></i>
                            <span slot="title">{{ item.title }}</span>
                        </template>
                        <template v-for="subItem in item.children">
                            <el-submenu
                                v-if="subItem.children"
                                :index="subItem.index"
                                :key="subItem.key"
                            >
                                <template slot="title">{{ subItem.title }}</template>
                                <el-menu-item
                                    v-for="(threeItem,i) in subItem.children"
                                    :key="threeItem.key"
                                    :index="threeItem.index"
                                >{{ threeItem.title }}</el-menu-item>
                            </el-submenu>
                            <el-menu-item
                                v-else
                                :index="subItem.index"
                                :key="subItem.key"
                            >
                            	<!--<i :class="subItem.icon"></i>-->
                            	<span slot="title">{{ subItem.title }}</span>
                            </el-menu-item>
                        </template>
                    </el-submenu>
                </template>
                <template v-else>
                    <el-menu-item :index="item.index" :key="item.key">
                        <i :class="item.icon"></i>
                        <span slot="title">{{ item.title }}</span>
                    </el-menu-item>
                </template>
            </template>
        </el-menu>
	</div>
</template>

<script>
	import sidebar from "./sidebar.js";
	export default sidebar;
</script>

<style>
	@import url("sidebar.css");
</style>